package com.youyi.yyviewsdklibrary.picker.impl;

import com.youyi.yyviewsdklibrary.picker.contract.DateFormatter;

public class UnitDateFormatter implements DateFormatter {
    private static String[] nStr1 = {"日", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"};
    private static String[] nStr2 = {"初", "十", "廿", "卅", "　"};
    boolean mIsOld = false;

    public UnitDateFormatter(boolean z) {
        this.mIsOld = z;
    }

    @Override // com.youyi.yyviewsdklibrary.picker.contract.DateFormatter
    public String formatYear(int i) {
        return i + "年";
    }

    @Override // com.youyi.yyviewsdklibrary.picker.contract.DateFormatter
    public String formatMonth(int i) {
        return i + "月";
    }

    @Override // com.youyi.yyviewsdklibrary.picker.contract.DateFormatter
    public String formatDay(int i) {
        if (this.mIsOld) {
            return chineseDay(i);
        }
        return i + "日";
    }

    public static String chineseDay(int i) {
        if (i == 10) {
            return "初十";
        }
        if (i == 20) {
            return "二十";
        }
        if (i == 30) {
            return "三十";
        }
        String str = nStr2[i / 10];
        return str + nStr1[i % 10];
    }
}
